Skip to content

Conversation

@dolfinus
Copy link
Contributor

@dolfinus dolfinus commented Sep 13, 2023


  • Deploy Airflow using Heml chart 1.10.0 with dags.gitSync.enabled=True
  • After testing git sync is working as expected, set dags.persistence.enabled=true to store dags to persistent volume instead of empty dir.
  • Got exception that git-sync-ssh-key volume is missing in scheduler pod description:
  volumes:
    - name: config
      configMap:
        name: airflow-airflow-config
    - name: dags
-     emptyDir: {}
-
-   - name: git-sync-ssh-key
-     secret:
-       secretName: airflow-ssh-secret
-       defaultMode: 288
+     persistentVolumeClaim:
+       claimName: airflow-dags
    - name: logs
      persistentVolumeClaim:
cannot patch "airflow-scheduler" with kind Deployment: Deployment.apps "airflow-scheduler" is invalid: [spec.template.spec.containers[1].volumeMounts[1].name: Not found: "git-sync-ssh-key", spec.template.spec.initContainers[1].volumeMounts[1].name: Not found: "git-sync-ssh-key"]
helm.go:84: [debug] cannot patch "airflow-scheduler" with kind Deployment: Deployment.apps "airflow-scheduler" is invalid: [spec.template.spec.containers[1].volumeMounts[1].name: Not found: "git-sync-ssh-key", spec.template.spec.initContainers[1].volumeMounts[1].name: Not found: "git-sync-ssh-key"]

helm.log

This is because of wrong condition in helm chart - git-sync-ssh-key volumeMount is always present in git-sync container inside scheduler pod, but corresponding volume is added to pod only if dags.persistence.enabled=false. Changed this condition to always add git-sync-ssh-key to scheduler volumes if git sync is enabled and ssh-key secret is passed to chart.

This issue was introduced in #22913 - git sync should be disabled on all pods if dag persistence is enabled, except scheduler (because scheduler pod is the sync point of dags).

^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@boring-cyborg boring-cyborg bot added the area:helm-chart Airflow Helm Chart label Sep 13, 2023
@dolfinus dolfinus marked this pull request as ready for review September 13, 2023 09:22
@dolfinus dolfinus marked this pull request as draft September 13, 2023 09:49
@dolfinus dolfinus force-pushed the main branch 3 times, most recently from 5c96f86 to e40c842 Compare September 13, 2023 11:14
@dolfinus dolfinus closed this Sep 13, 2023
@dolfinus dolfinus reopened this Sep 13, 2023
@dolfinus dolfinus marked this pull request as ready for review September 13, 2023 11:27
@dolfinus dolfinus marked this pull request as draft September 13, 2023 11:27
@dolfinus dolfinus force-pushed the main branch 3 times, most recently from 94cfde3 to 3977083 Compare September 13, 2023 13:34
@dolfinus dolfinus marked this pull request as ready for review September 13, 2023 15:14
@dolfinus
Copy link
Contributor Author

This is alternative implementation of #30896

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Oct 29, 2023
@dolfinus
Copy link
Contributor Author

Could anyone take a look?

@github-actions github-actions bot removed the stale Stale PRs per the .github/workflows/stale.yml policy file label Oct 30, 2023
@eladkal
Copy link
Contributor

eladkal commented Oct 30, 2023

Could anyone take a look?

needs rebase and resolve conflicts

@eladkal eladkal added this to the Airflow Helm Chart 1.12.0 milestone Oct 30, 2023
@dolfinus dolfinus closed this Oct 31, 2023
@dolfinus
Copy link
Contributor Author

needs rebase and resolve conflicts

Done

@eladkal
Copy link
Contributor

eladkal commented Nov 1, 2023

@hussein-awala can you take a look?

@dolfinus
Copy link
Contributor Author

So?

@romsharon98
Copy link
Contributor

This pr will solve the problem.
But isnt this solution is better? #30896
Because in the current solution we will add git-ssh even though we don't need it.

@dolfinus
Copy link
Contributor Author

even though we don't need it

Please describe this in more details.

@potiuk
Copy link
Member

potiuk commented Nov 25, 2023

I would strongly discourage using both git-sync and persistence. I am very close to propose (I did have a PR in the past about it) such combo should be forbidden because it leads to very brittle behaviour and you might have alot of problems with it. So I would rather not make it easier for people using it, to be honest.

I still failed to see where it might bring any use and there are multiple problems such setup might cause - depending on - for example - whether your persistence solution has provisioned IOPS and how "distributed" your setup is and what kind of the PVC you configure.

You can read more about it here: https://airflow.apache.org/docs/helm-chart/stable/manage-dags-files.html#notes-for-combining-git-sync-and-persistence

Also if you would like to read more and see if your solution might work better (depending on the way which PVC you are using and what kind of K8S you run and how distributed your cluster is) you can read about it in my blog post where I explained why combining Persistence and Git Sync is a bad idea:

https://medium.com/apache-airflow/shared-volumes-in-airflow-the-good-the-bad-and-the-ugly-22e9f681afca

Generally you are shooting yourself in the foot by enabling both at the same time.

I am not sure we want to fix anything about git-sync + persistence combo to be honest. I don't thinlk we should make it easier for our users to shoot htemselves in their foot. I'd rather see a PR disabling this combo.

@dolfinus
Copy link
Contributor Author

dolfinus commented Nov 26, 2023

I'd rather prefer to show some kind of warning in such a case than completely forbid it. Some users may successfully use this combination, there is no statistics related to this

@potiuk
Copy link
Member

potiuk commented Nov 26, 2023

I'd rather prefer to show some kind of warning in such a case than completely forbid it. Some users may successfully use this combination, there is no statistics related to this

Yes. That was also my initial thought and PR, but I could not find a way how to show warning to helm users in this case - there seem to be no good way of passing any warning informatiob to users for combination of parameters in the template that should be avoided.

Do you have some idea how to do it @dolfinus ? Or maybe even you would like to submit a PR doing it ?

@dolfinus
Copy link
Contributor Author

No idea, and I'm not interested in this kind if solution.

@potiuk
Copy link
Member

potiuk commented Nov 26, 2023

No idea, and I'm not interested in this kind if solution.

Pity. You loose opportunity to become one of 2700 contributors to Airflow.

@dolfinus
Copy link
Contributor Author

dolfinus commented Nov 26, 2023

You loose opportunity to become one of 2700 contributors to Airflow.

I already am.

If maintainers are not interested of merging PR which avoids producing wrong pod description, and instead prefer to do nothing with that for months - ok, but very pitty to hear.

@potiuk
Copy link
Member

potiuk commented Nov 26, 2023

If maintainers are not interested of merging PR which avoids producing wrong pod description, and instead prefer to do nothing with that for months - ok, but very pitty to hear.

Well. Maintainers are interested in getting future looking solution that not only solve this problem but will prevent users from shooting themselves in their foot and then opening even more issues when the do and have weird problems. Sometimes putting a small patch where your blood is poisoned, will make you die anyway, but you will not realize it because you turn a blind eye and pretend that tbe bigger problem does not exist.

So -if this PR (which I hope it will) will start a discussion that will lead to a better solution, that might be the best outcome of this PR. Merging it now without discussion will simply let people turn a blind eye on the real issue we have, so I would strongly suggest to discuss alternatives and see what other proposals people have knowing the context.

If you think we are doing nothing here, you are completely wrong:

Yet - despite the very explicit and strong warning - people like you continue ignoring the strong discouragement we have and raise issues about some of the things not working with this combo - which of course are unrelated, but they are - again - turning a blind eye not realising they have a bigger problem and that what they do is really poisonous blood in their organism that they are trying to put patch on.

So yeah. I am not thinking about doing nothing. I am looking for other's comments and suggestions what we do in this situation - including taking your suggestion about warning (which I have no idea how to do even if I tried in the original PR).

It's a pity that some users are complaining, when the maintainers actually go to a great length to solve the actual problems rather than let their users to patch and turn blind eye on the bigger problems they have. I'd say it would be an easy solution to just merge the PR. yet I've chosen a much more demanding approach that could help to solve bigger problem if we have people helping here.

Copy link
Member

@potiuk potiuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just making it "request changes" until I hear from others what they think

@dolfinus
Copy link
Contributor Author

What exactly are we waiting here?

@potiuk
Copy link
Member

potiuk commented Dec 16, 2023

We are waiting to hear from others.

@dolfinus dolfinus closed this Dec 16, 2023
@dolfinus
Copy link
Contributor Author

If nobody is interested in this, I don't see any reason to keep this open

@amoskueez
Copy link

we are interested in this

@potiuk
Copy link
Member

potiuk commented Dec 31, 2023

we are interested in this

Feel free to create PR and lead it completion then @amoskueez . Nothing more is needed here.

@dolfinus
Copy link
Contributor Author

dolfinus commented Jan 6, 2024

Second try: #36628

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:helm-chart Airflow Helm Chart

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants